/**
 * Created by Administrator on 16-3-10.
 * 定义全局变量,常量
 */
import React from 'react';
import {
    Platform,
    Dimensions,
    PixelRatio
} from 'react-native';

var  screenWidth=Dimensions.get('window').width;
var  screenHeight=Dimensions.get('window').height;

var baseColor="#58a0ff"
//判断字符串是否以某个字符串结尾
String.prototype.endWith=function(endStr){
      var d=this.length-endStr.length;
      return (d>=0&&this.lastIndexOf(endStr)==d)
}
String.prototype.replaceAll = function(s1,s2) { 
    return this.replace(new RegExp(s1,"gm"),s2); 
}
String.prototype.trim = function() { 
    return this.replace(new RegExp(" ","gm"),""); 
}
 Date.prototype.format = function (fmt) { //author: zhengsh 2016-9-5 
     var o = {
         "M+": this.getMonth() + 1, //月份 
         "d+": this.getDate(), //日 
         "h+": this.getHours(), //小时 
         "m+": this.getMinutes(), //分 
         "s+": this.getSeconds(), //秒 
         "q+": Math.floor((this.getMonth() + 3) / 3), //季度 
         "S": this.getMilliseconds() //毫秒 
     };
     if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
     for (var k in o)
    if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
     return fmt;
}
var pixe=PixelRatio.get()
const basePx = 375
var Size=function(font){
	// if(pixe<=2){
	// 	return font;
	// }else{
	// 	return parseInt(font-(pixe-2)*2);
	// }
	return font *  screenWidth / basePx
}

// const isDebug=false;
// if(!isDebug){
// 	console.log=function(text){}
// }

const AppImages={
	// default_png:{uri:'default_no'},
	// right_line:{uri:'rightgo'},
	// activity:{uri:'activity'},
	// iconSource:{uri:'date_icon'},
	// hdbq:{uri:'xsqg'},
	// unloginhead:{uri:'unloginhead'},
	// huhutong:{uri:'huhutong'},
	// sdjManager:{uri:"sdj_manager"},
	// guidePrice:{uri:'guide_price'},
	// offlineOrder:{uri:'offline_order'},
	// invoicing_head:{uri:'invoicing_head'},
	// launchImg:{uri:Platform.OS!="android"?"bootup_640":"background"},
	// door_nodata_height:{uri:'door_nodata_height'},
	// door_nodata_width:{uri:'door_nodata_width'},
	// jiyaList_small_img:{uri:'jiyalist_small_img'},
}
module.exports ={AppImages,Size,screenWidth,screenHeight,console}
